home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PC World Komputer 2010 April
/
PCWorld0410.iso
/
pluginy Firefox
/
60
/
60.xpi
/
chrome
/
webdeveloper.jar
/
content
/
webdeveloper
/
common
/
array.js
< prev
next >
Wrap
Text File
|
2009-06-30
|
1KB
|
59 lines
// Returns true if the array contains the element
function webdeveloper_contains(array, element)
{
// If the array and element are set
if(array && element)
{
try
{
// If the element does not exist in the array
if(array.indexOf(element) == -1)
{
return false;
}
else
{
return true;
}
}
catch(exception)
{
var arrayLength = array.length;
// Loop through the array
for(var i = 0; i < arrayLength; i++)
{
// If the element is found
if(array[i] == element)
{
return true;
}
}
}
}
return false;
}
// Returns true if the array contains media with the given URL
function webdeveloper_mediaArrayContains(array, url)
{
// If the array and url are set
if(array && url)
{
var arrayLength = array.length;
// Loop through the array
for(var i = 0; i < arrayLength; i++)
{
// If media with the given URL is found
if(array[i].src == url)
{
return true;
}
}
}
return false;
}